// 混合类型接⼝
interface Counter {
    (start: number): void;

    interval: number;

    reset(): void;

    // [index: number]: number;

    // [key: string]: number | (() => void);  // 允许数字或函数类型
}

function getCounter(): Counter {
    // 创建⼀个计数器函数，并通过类型断⾔赋予其Counter接⼝
    let counter: Counter = function (start: number) {
    } as Counter;
    // 设置计数器的默认间隔时间为100毫秒
    counter.interval = 100;
    // 实现计数器的重置⽅法
    counter.reset = function () {
    };
    // 返回计数器实例
    return counter;
}


interface Person1 {
    name: string;
    age: number;
}

interface Person1 {
    city: string;
}

// type Person = {
//     name: string;
// };
type Person = {
    age: number;
};
type ID = number | string;
type IDD = number;

let id1: ID = 123;
let p: Person1 = {
    name: "张三",
    age: 18,
    city: "长沙"
};
